package chap9;
//******************************************************************
//  MonetaryCoinTest.java           Author:GK
//
//  实例化MonetaryCoinTest对象，计算若干个对象和，演示继承了其父类
//  的抛硬币功能。
//******************************************************************

public class MonetaryCoinTest {
    public static void main(String[] args) {

        MonetaryCoin[] Coins = new MonetaryCoin[3];
        Coins[0] = new MonetaryCoin(1.0);
        Coins[1] = new MonetaryCoin(0.5);
        Coins[2] = new MonetaryCoin(0.1);

        double sum = 0;
        for (MonetaryCoin Coin : Coins) {
            sum += Coin.face();
        }

        System.out.println("和为： " + sum);

        Coins[0].flip();   // 抛硬币。
        System.out.println(Coins[0]);

    }
}
